curdir=`pwd`
dir="$curdir/squashfs-root"
oldfile="PandoraBox-ralink-mt7620-mo.bin"
openwrt-repack.sh $oldfile -U
cd ../drcom/
cp drcom.py $dir/bin/
cp pppoe.sh $dir/bin/
cp drcomup.sh drcomup
gzexe drcomup
cp drcomup $dir/bin/
chmod 777 $dir/bin/pppoe.sh $dir/bin/drcom.py $dir/bin/drcomup
cp drcom.lua $dir/usr/lib/lua/luci/controller/
#mkdir cbi
#cp cbidrcom.lua cbi/drcom.lua
cp cbi/drcom.lua $dir/usr/lib/lua/luci/model/cbi/
cp drcom $dir/etc/config/
cp rc.local $dir/etc/
#cp network $dir/etc/config/
cp 99-drcom $dir/etc/hotplug.d/iface/
cp header.htm $dir/usr/lib/lua/luci/view/themes/LuciXEyE
cp $dir/lib/netifd/proto/ppp.sh $dir/lib/netifd/proto/ppp.sh_bak
sed -i '/proto_run_command/i  uci get drcom.config.enable && username=`echo -e "\\r\\n$username"`' $dir/lib/netifd/proto/ppp.sh
cd $curdir
openwrt-repack.sh -R PandoraBox-14.09_gdut_$1_xiaomimini_k2.bin